pygrub's individual config file parsers do not correctly check the
amount of command line arguments given to them. In addition, the LILO
config parser would report an incorrect message.
Use len() to correctly check the amount of arguments, and fix the LILO
error message.
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
}
if __name__ == "__main__":
- if sys.argv < 2:
+ if len(sys.argv) < 2:
raise RuntimeError, "Need a configuration file to read"
g = ExtLinuxConfigFile(sys.argv[1])
for i in g.images:
}
if __name__ == "__main__":
- if sys.argv < 3:
+ if len(sys.argv) < 3:
raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read"
if sys.argv[1] == "grub":
g = GrubConfigFile(sys.argv[2])
}
if __name__ == "__main__":
- if sys.argv < 2:
- raise RuntimeError, "Need a grub.conf to read"
+ if len(sys.argv) < 2:
+ raise RuntimeError, "Need a lilo.conf to read"
g = LiloConfigFile(sys.argv[1])
for i in g.images:
print i #, i.title, i.root, i.kernel, i.args, i.initrd